import request from '../utils/request';
import ServiceInfoManager from '../utils/ServiceInfoManager';
// 获取用户信息

// eslint-disable-next-line import/prefer-default-export
// TODO
export async function getProductConfigs({ platform = 'wechat', code = '' }) {
  const openApiUrl = await ServiceInfoManager.getOpenApiUrl();
  const url = `${openApiUrl}v1/products/configs/token/${code}?platform=${platform}`;
  const option = {
    method: 'Get',
  };
  const data = await request(url, option);
  console.log('getProductConfigs', data);
  let returnData: any = {};
  if (data.err) {
    // 错误
    returnData.code = data.err.response.status;
    returnData.success = false;
  } else {
    returnData = data.data;
    returnData.success = true;
  }
  return returnData;
}
